<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考试计划列表</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/common/plugin/jquery.min.js"></script>
<script type="text/javascript" src = "<%=request.getContextPath() %>/static/teach/js/record-list.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/static/sys/user/css/user-list.css"/>
</head>
<body>

	<form id="myform1" name="myform1" action="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=list" method="post">
	               
	                 类　　型:<input type="text" value="${coursename }" name="coursename"/>　
	                 所属增加:<select name="ifmyupdte" Style="width:90px; height: 25px">
	                 <c:set var ="ifmyupdte" value="${ifmyupdte }"></c:set>
	                 <option value="0" align="center" <c:if test="${ifmyupdte ==0 }">selected = "selected" </c:if>>全　部</option>
	                 <option value="1" align="center" <c:if test="${ifmyupdte ==1 }">selected = "selected" </c:if>>我所新增</option>
	                 <option value="2" align="center" <c:if test="${ifmyupdte ==2 }">selected = "selected" </c:if>>其他新增</option>
	              </select>　　
	                 状　　态:<select name="state" style=" width:90px ; height:25px">
	                <c:set var ="state" value="${state }"></c:set>
	                 <option value="0"　align="center" <c:if test="${state ==0 }">selected = "selected" </c:if>>　请选择　</option>
	                 <option value="1"　align="center" <c:if test="${state ==1 }">selected = "selected" </c:if>>　有效　</option> 
	                 <option value="2" align="center" <c:if test="${state ==2 }">selected = "selected" </c:if>>　无效　</option>
	                 <option value="3"　align="center" <c:if test="${state ==3 }">selected = "selected" </c:if>>　已删除　</option> 
	              </select>
	        　  　是否过期:<select name="timed" style=" width:90px ; height:25px">
	                <c:set var="timed" value="${timed }"></c:set>
	        　　　　　　　　  <option value="0"　align="center" >　请选择　</option>
	                <option value="1"　align="center" <c:if test="${timed ==1 }">selected = "selected" </c:if>>　是　</option> 
	                <option value="2"　align="center" <c:if test="${timed ==2 }">selected = "selected" </c:if>>　否　</option>
	             </select>
	     <input type="submit" value="提交"/>
	    </form>
<%--表格形式显示数据 --%>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="6%" height="19" valign="bottom"><div align="center"><img src="<%=request.getContextPath()%>/static/common/basic-page/images/tb.gif" width="14" height="14" /></div></td>
                <td width="94%" valign="bottom"><span class="STYLE1"> 管理人员基本信息列表</span></td>
              </tr>
            </table></td>
            <td><div align="right"><span class="STYLE1">
              <input type="checkbox" name="checkbox11" id="checkbox11" />
              全选      &nbsp;&nbsp;<a href="<%=request.getContextPath() %>/user/AllUserCommandServlet?command=toAddUser"><img src="<%=request.getContextPath()%>/static/common/basic-page/images/add.gif" width="10" height="10" /> 添加</a>   &nbsp; <img src="<%=request.getContextPath()%>/static/common/basic-page/images/del.gif" width="10" height="10" /> 删除    &nbsp;&nbsp;<img src="<%=request.getContextPath()%>/static/common/basic-page/images/edit.gif" width="10" height="10" /> 编辑   &nbsp;</span><span class="STYLE1"> &nbsp;</span></div></td>
          </tr>
        </table>
        </td>
      </tr>
    </table>
    </td>
	</tr>
	<tr>
<td>
	<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
		<thead>
		    <tr>
		    <td colspan="7" align="right"><a
			href="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=explanadd">新增考试安排</a>&nbsp</td>
      </tr>
	<tr>
		<th width="4%" height="20" bgcolor="d3eaef" class="STYLE10">
		<div align="center">
			<input type="checkbox" name="checkbox" id="checkbox" />
		</div>
		<td height="25" bgcolor="d3eaef" class="STYLE19"><div align="center"><span class="STYLE10">序号</span></div></td>
		<td height="25" bgcolor="d3eaef" class="STYLE19"><div align="center"><span class="STYLE10">考试时间</span></div></td>
		<td height="25" bgcolor="d3eaef" class="STYLE19"><div align="center"><span class="STYLE10">考试教室</span></div></td>
		<td height="25" bgcolor="d3eaef" class="STYLE19"><div align="center"><span class="STYLE10">试卷名称</span></div></td>
		<td height="25" bgcolor="d3eaef" class="STYLE19"><div align="center"><span class="STYLE10">状　　态</span></div></td>
		<td height="25" bgcolor="d3eaef" class="STYLE19"><div align="center"><span class="STYLE10">操　　作</span></div></td>
	</tr>
</thead>
<tbody>
<c:forEach items="${pageModel.list}" var="examplan"  varStatus="v">
			<tr>
			<td height="25" bgcolor="#FFFFFF"><div align="center">
		          <input type="checkbox" name="checkbox4" id="checkbox4" />
		    </div></td>
			<td height="25" bgcolor="d3eaef" class="STYLE10" scope="row"> ${v.count+(pageModel.pageNo-1)*pageModel.pageSize} </td>
			<td height="25" bgcolor="d3eaef" class="STYLE10"><fmt:formatDate value="${examplan.exam_Time_Start }" pattern="yyyy-MM-dd HH:mm:ss"/>
                 —　<fmt:formatDate value="${examplan.exam_Time_Stop }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			<td height="25" bgcolor="d3eaef" class="STYLE10">${examplan.exam_Classroom }</td>
			<td height="25" bgcolor="d3eaef" class="STYLE10">${examplan.name }</td>
			<td height="25" bgcolor="d3eaef" class="STYLE10">
				<c:set var="state" value="${examplan.state }"></c:set>
					<c:if test="${state == 1 }">有效</c:if>
				<c:if test="${state == 2}">待生效</c:if>
				<c:if test="${state == 3 }">已删除</c:if>
			</td>
			<td height="25" bgcolor="d3eaef" class="STYLE10">
				<c:set var="plan_id" value="${examplan.operate_user_id }"></c:set>
		        <c:set var="user_id" value="${userId }"></c:set>
		        <a href="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=examPlanDetail&id=${examplan.id }" >详情 </a>
		        <c:if test="${plan_id == user_id }">
			        <c:set var="state" value="${examplan.state }"></c:set>
			        <c:if test="${state == 1 }">
			           |<a href="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=UpdateState&state=3&id=${examplan.id }" onclick="return confirm('考试安排已执行，是否确定删除？');">删除</a>
			        </c:if>
			        <c:if test="${state == 2 }">
			           |<a href="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=UpdateState&state=1&id=${examplan.id }" >生效</a>
			           |<a href="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=UpdateState&state=3&id=${examplan.id }" onclick="return confirm('考试安排已执行，是否 确定删除？');">删除</a>
			        </c:if>
		        </c:if>
		   </td>
	</tr> 
</c:forEach>
<%-- <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考试安排</title>

</head>
<body>
   <table border="1" width="100%">
	 <caption><h1><a href="<%=request.getContextPath() %>" title="点击新增班级" style="text-decoration:none">考试安排</a></h1></caption>

      <thead>
	  <tr align="left" height="50px"　>
	   <th  colspan="6">
	    <form id="myform1" name="myform1" action="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=ifSelect" method="post">
	                 类　　型:<input type="text" value="${coursename }" name="coursename"/>　　　
	                 状　　态:<select style=" width:90px ; height:25px">
	                 <option value="0"　align="center">　请选择　</option>
	                <option value="1"　align="center">　有效　</option> 
	                <option value="2"　align="center">　无效　</option>
	                <option value="3"　align="center">　已删除　</option>  
	              </select>
	        　　是否过期:<select style=" width:90px ; height:25px">
	        　　　　　　　　<option value="0"　align="center">　请选择　</option>
	                <option value="1"　align="center">　是　</option> 
	                <option value="2"　align="center">　否　</option>
	              </select>
	     <input type="submit" value="提交"/>
	    </form>
	   </th>
	   </tr>
	  </thead>
	
	  <tbody>
	   <tr align="center" bgcolor="#CCFFFF" height="30px">
	      <th><b>考试时间</b></th>
	      <th><b>考试教室</b></th>
	      <th><b>试卷名称</b></th>
	      <th><b>状　　态</b></th>
	      <th><b>操　　作</b></th>
	   </tr>
	  </tbody>
	  
	  <c:forEach items="${pageModel.list }" var="examplan">
	      <tr>
	         <th><fmt:formatDate value="${examplan.exam_Time_Start }" pattern="M月dd日 H小时m分"/>
	             —　<fmt:formatDate value="${examplan.exam_Time_Stop }" pattern="M月dd日 H小时m分"/>
	         </th>
	         <th>${examplan.exam_Classroom }</th>
	         <th>${examplan.name }</th>
	         <!--状态  -->
	         <th>
	         <c:set var="state" value="${examplan.state }"></c:set>
	         <c:if test="${state == 1 }">有效</c:if>
	         <c:if test="${state == 2}">无效</c:if>
	         <c:if test="${state == 3 }">已删除</c:if>
	         </th>
	         <!-- 操作 -->
	         <th>
	        <c:set var="plan_id" value="${examplan.operate_user_id }"></c:set>
	        <c:set var="user_id" value="${userId }"></c:set>
	        <c:if test="${plan_id == user_id }">
	           <a href="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=examPlanDetail&id=${examplan.id }" >详情 </a>
	           <c:set var="state" value="${examplan.state }"></c:set>
	            <c:if test="${state == 1 }">
	           |　<a href="">删除</a>
	           </c:if>
	           <c:if test="${state == 2 }">
	            |　<a href="">生效</a>　|　<a href="">删除</a>
	           </c:if>
	           <c:if test="${state == 3 }">
	           
	           </c:if>
	      </c:if>
	     </th>
	    </tr>
	  </c:forEach> --%>
	  <tfoot>
	     <tr>
			<td colspan="12" align="right">
				<a href = "javascript:;" onclick="submitCondition(${pageModel.first});">首页</a>&nbsp;
				<a href = "javascript:;" onclick="submitCondition(${pageModel.pre});">上一页</a>&nbsp;
				第<select onchange="goPage(this)">
					<script>
						var pageNo = '${pageModel.pageNo}';
						var totalPage = '${pageModel.totalPage}';
						for (var i = 1; i <= totalPage; i++) {
							if (pageNo == i) {
								document.write('<option value="' + i + '" selected="selected">' + i + '</option>');
							} else {
								document.write('<option value="' + i + '">' + i + '</option>');
							}
						}
					</script>
				 </select>页
				,共${pageModel.totalPage}页&nbsp;
				<a href = "javascript:;" onclick="submitCondition(${pageModel.next});">下一页</a>&nbsp;
				<a href = "javascript:;" onclick="submitCondition(${pageModel.last});">尾页</a>&nbsp;
				共${pageModel.allRecords }条记录
			</td>
		</tr>
	  </tfoot>
	</table>
</body>
<script>
		/**
		 * 控制表单提交
		 */
		function submitCondition(pageNo){
			document.myform1.action="<%=request.getContextPath()%>/teach/examplan/ExamPlanServlet?command=list&pageNo="+pageNo;
			document.myform1.submit();
		}
		/**
		 * 页面直接跳转
		 */
		function goPage(obj){
			submitCondition(obj.value);
		}
</script>
</html>
